package com.hontech.bvapp2.ui.parts.drop

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bvapp2.R
import com.hontech.bvapp2.device.cp.Drop
import com.hontech.bvapp2.ui.dialog.runProg
import com.hontech.bvapp2.utils.onClick

class DropCutParts (context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_drop_cut, this)
        val down = view.findViewById<Button>(R.id.id_drop_btn_cut_down)
        val up = view.findViewById<Button>(R.id.id_drop_btn_cut_up)

        down.onClick {
            runProg("切膜电机", "向下") {
                Drop.cutFilm(1)
            }
        }

        up.onClick {
            runProg("切膜电机", "向上") {
                Drop.cutFilm(0)
            }
        }

    }
}